//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.滑动窗口.定长滑动窗口;

public class demo_1343 {
    public demo_1343() {
    }

    public int numOfSubarrays(int[] arr, int k, int threshold) {
        int sum = 0;
        int count = 0;

        for(int i = 0; i < arr.length; ++i) {
            sum += arr[i];
            if (i >= k - 1) {
                if (sum / k >= threshold) {
                    ++count;
                }

                sum -= arr[i - k + 1];
            }
        }

        return count;
    }
}
